<div id="appointment-manage-view">
  <!--<div class="pageheader">-->
    <!--<h2><i class="fa fa-home"></i>预约管理</h2>-->
  <!--</div>-->
  <div class="page">
    <div class="al-list-container">
      <form class="form-horizontal al-search-container" role="form">
        <div class="form-group">
          <label class="col-sm-1 control-label">公寓</label>
          <div class="col-sm-3" ng-if="apartmentList.length>1">
            <qgy-apartment-item apm-data="search" apm-param="buzProduct" apm-list="apartmentList"></qgy-apartment-item>
          </div>
          <label class="col-sm-1 control-label">预约日期</label>
          <div class="col-sm-2">
            <div class="input-group">
              <input class="form-control" type="text" uib-datepicker-popup="yyyy-MM-dd"
                     ng-model="search.startTime" is-open="enterStart" maxlength="10"
                     close-text="关闭" current-text="今天" clear-text="清空"
                     placeholder=""/>
              <span class="input-group-btn">
                <button type="button" class="btn btn-default" ng-click="enterStart=true">
                  <i class="glyphicon glyphicon-calendar"></i>
                </button>
              </span>
            </div>
          </div>
          <label class="control-label text-center al-fl-lt">&nbsp;&nbsp;~&nbsp;&nbsp;</label>
          <div class="col-sm-2">
            <div class="input-group">
              <input class="form-control" type="text" uib-datepicker-popup="yyyy-MM-dd"
                     ng-model="search.endTime" is-open="enterEnd" maxlength="10"
                     close-text="关闭" current-text="今天" clear-text="清空"
                     placeholder=""/>
              <span class="input-group-btn">
                <button type="button" class="btn btn-default" ng-click="enterEnd=true">
                  <i class="glyphicon glyphicon-calendar"></i>
                </button>
              </span>
            </div>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-1 control-label">状态</label>
          <div class="col-sm-3">
            <label class="ui-radio">
              <input name="status" ng-value="1" type="checkbox" ng-model="search.status_1" ng-checked="isSelected(1)" ng-click="updateSelection($event,1)">
              <span>待沟通</span>
            </label>
            <label class="ui-radio">
              <input name="status" ng-value="2" type="checkbox" ng-model="search.status_2"  ng-checked="isSelected(2)" ng-click="updateSelection($event,2)">
              <span>待看房</span>
            </label>
          </div>
          <label class="col-sm-1 control-label">看房日期</label>
          <div class="col-sm-2">
            <div class="input-group">
              <input class="form-control" type="text" uib-datepicker-popup="yyyy-MM-dd"
                     ng-model="search.startProviderTime" is-open="startProvider" maxlength="10"
                     close-text="关闭" current-text="今天" clear-text="清空"
                     placeholder=""/>
              <span class="input-group-btn">
                <button type="button" class="btn btn-default" ng-click="startProvider=true">
                  <i class="glyphicon glyphicon-calendar"></i>
                </button>
              </span>
            </div>
          </div>
          <label class="control-label text-center al-fl-lt">&nbsp;&nbsp;~&nbsp;&nbsp;</label>
          <div class="col-sm-2">
            <div class="input-group">
              <input class="form-control" type="text" uib-datepicker-popup="yyyy-MM-dd"
                     ng-model="search.endProviderTime" is-open="endProvider" maxlength="10"
                     close-text="关闭" current-text="今天" clear-text="清空"
                     placeholder=""/>
              <span class="input-group-btn">
                <button type="button" class="btn btn-default" ng-click="endProvider=true">
                  <i class="glyphicon glyphicon-calendar"></i>
                </button>
              </span>
            </div>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-1 control-label"></label>
          <div class="col-sm-3">
            <label class="ui-radio">
              <input name="status" ng-value="3" type="checkbox" ng-model="search.status_3"  ng-checked="isSelected(3)" ng-click="updateSelection($event,3)">
              <span>已取消</span>
            </label>
            <label class="ui-radio">
              <input name="status" ng-value="4" type="checkbox" ng-model="search.status_4"  ng-checked="isSelected(4)" ng-click="updateSelection($event,4)">
              <span>已看房</span>
            </label>
          </div>
          <div class="col-sm-4 col-sm-offset-1">
            <input type="text" class="form-control" ng-model="search.filter"
                   placeholder="预约人,手机号,销售姓名" maxlength="32">
          </div>
          <div class="col-sm-1 ">
            <button type="button" ng-click="queryData()" class="btn btn-success al-float-right">查询</button>
          </div>
          <div class="col-sm-1">
            <button type="button" ng-click="resetSearch()" class="btn btn-default">重置</button>
          </div>
          <div class="col-sm-1">
            <button type="button" ng-click="newData()" class="btn btn-warning">代客预约</button>
          </div>
        </div>
      </form>
      <table ng-table="tableParams"
             class="table  table-bordered table-striped table-condensed al-table-container">
        <thead>
        <tr>
          <td>预约人</td>
          <td>手机号</td>
          <td>公寓名称</td>
          <td>房型</td>
          <td>看房时间</td>
          <td>销售</td>
          <td>销售电话</td>
          <td>客服备注</td>
          <td>预约时间</td>
          <td>状态</td>
          <td>操作</td>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="item in $data">
          <td>{{item.userName}}</td>
          <td>{{item.userPhone}}</td>
          <td>{{item.buzProductName}}</td>
          <td>{{item.buzItemName}}</td>
          <td>{{item.providerTime|dateTransfer:'YYYY-MM-DD HH:mm'}}</td>
          <td>{{item.providerName}}</td>
          <td>{{item.providerPhone}}</td>
          <td>{{item.dealResult}}</td>
          <td>{{item.createTime|dateTransfer:'YYYY-MM-DD'}}</td>
          <td>{{item.statusName}}</td>
          <td>
            <button class="btn btn-info btn-sm" ng-if="item.status==1 || item.status==2" ng-click="dealAppoint(item)">处理</button>
            <button class="btn btn-success btn-sm" ng-click="viewData(item)">查看</button>
          </td>
        </tr>
        </tbody>
      </table>
    </div>
  </div>
</div>
